package com.fegin.client.app;

import com.fegin.Hystrix.app.StockUserFeginHystrix;
import com.fegin.bean.app.StockUser;
import com.fegin.common.ServerNameConstant;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * @author 张子艺
 * @packge com.fegin.client
 * @data 2019-02-19 13:59
 * @project CurrenCy-Cloud
 */
@FeignClient(value = ServerNameConstant.APP_SERVER, fallbackFactory  = StockUserFeginHystrix.class)
public interface StockUserFegin {

    /**
     * 登陆
     * @param account 账号  手机号/邮箱
     * @param pswd   密码
     * @return
     */
    @RequestMapping(value = "/app/stockUser/login",
            method = RequestMethod.GET,
            consumes = MediaType.APPLICATION_JSON_VALUE
    )
    Map<String,Object> login(@RequestParam("account")String account,@RequestParam("pswd")String pswd);

    /**
     * 新增用户或修改用户信息
     * 如果是修改  那么ID必传  其余参数 修改哪个字段 传哪个字段参数
     * 如果是新增  ID必须为空
     * @param stockUser  用户信息
     * @return
     */
    @RequestMapping(value = "/app/stockUser/insertOrUpdate",
            method = RequestMethod.GET,
            consumes = MediaType.APPLICATION_JSON_VALUE
    )
    Map<String,Object> insertOrUpdate(@RequestBody StockUser stockUser);


}
